<?php
namespace Home\Controller;

use Think\Controller;

//首页-控制器
class DownloadController extends Controller {

	private $videoBookModel;   //预定订单
	private $videoBookInfoModel;
	private $UserModel;

    public function __construct(){
        parent::__construct();
        //获取的model作为私有属性
        $this->videoBookModel      = D('VideoBook');      //预定订单
        $this->videoBookInfoModel  = D('videoBookInfo');
        $this->UserModel           = D('user');
    }


//=========================================================================================================================================

    /**
     * 试看视频的页面↓【暂弃
     */
    public function pre_purchase(){
        $this->display('downloadVideo');
    }

    public function takeVideo(){
        $priceWhere['id']            = I('post.orderid');
        $priceWhere['get_video_num'] = I('post.takeno');
        $ordersn                     = $this->videoBookModel->where($priceWhere)->getField('ordersn');
        //查询视频url
        $Where['ordersn'] = $ordersn;
        $video            = $this->videoBookInfoModel->where($Where)->getField('video_final');
        $video_url        = "/Upload/".$video;
        if ( !empty($video) ) {
            $this->ajaxReturn(array('status'=>1,'info'=>'提取成功','url'=>$video_url));
        }else{
            $this->ajaxReturn(array('status'=>0,'info'=>'提取失败','url'=>$video_url));
        }

    }

}
